package com.hhit.bigscreenbackmanage.controller.gis;

import com.alibaba.fastjson.JSONObject;
import com.hhit.bigscreenbackmanage.common.Response;
import com.hhit.bigscreenbackmanage.dao.gis.TGisSituationDAO;
import com.hhit.bigscreenbackmanage.service.gis.TGisSituationService;
import com.hhit.bigscreenbackmanage.vo.gis.GisAqglVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @Author zhl
 * @Date 2021/7/22
 */
@RestController
@RequestMapping("/TgisFlie")
public class TGisFilecontroller {

    private static Logger log = LoggerFactory.getLogger(TGisFilecontroller.class);

    @Autowired
    private TGisSituationService tGisSituationService;

    /**
     * 查询数据
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getTGisFileData")
    public Response getTGisFileData(@RequestBody JSONObject jsonObject){
        try{
            Map<String, Object> result = tGisSituationService.queryTGisFileData(jsonObject);
            return Response.createResponseBySuccess("查询数据成功",result);
        }catch (Exception e){
            log.error("查询数据失败: " + e.getMessage());
            return Response.createResponseByError("查询数据失败");
        }
    }


    /**
     * 查询根据地市查询数据
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getTGisDataByds")
    public Response getTGisDataByds(@RequestBody JSONObject jsonObject){
        try{
            List<GisAqglVO> result = tGisSituationService.getTGisDataByds(jsonObject);
            return Response.createResponseBySuccess("查询数据成功",result);
        }catch (Exception e){
            log.error("查询数据失败: " + e.getMessage());
            return Response.createResponseByError("查询数据失败");
        }
    }

    /**
     * 查询特高压数据
     * @param jsonObject
     * @return
     */
    @RequestMapping("/getTGisDataByTgy")
    public Response getTGisDataByTgy(@RequestBody JSONObject jsonObject){
        try{
            List<GisAqglVO> result = tGisSituationService.getTGisDataByTgy(jsonObject);
            return Response.createResponseBySuccess("查询数据成功",result);
        }catch (Exception e){
            log.error("查询数据失败: " + e.getMessage());
            return Response.createResponseByError("查询数据失败");
        }
    }


}
